﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace tank
{
    enum _BlockType
    {
        Base,
        Brick_Box_Def,
        Brick_Box_Iron,
        Brick_Box_Red,
        Place_Green
    } 
    class _Block
    {
        public int life { get; set; }
        public Point Location { get; set; }
        public Size Size { get; set; }
        public _BlockType BlockType { get; set; }
        public Image Img { get; set; }
        public int Var { get; set; }

        public Rectangle Rectangle
        {
            get { return new Rectangle(Location, Size); }
        }
        Random rnd1 = new Random(DateTime.Now.Millisecond);
        public _Block(Point location, _BlockType blockType,int life)
        {
            this.life = life;
            Location = location;
            this.BlockType = blockType;
            this.Var = rnd1.Next(1, 3);
            Size = new Size(42, 42);
            switch (blockType)
            {
                case _BlockType.Brick_Box_Def:
                    {
                        switch (Var)
                        {
                            case 1: Img = tank.Properties.Resources._1;
                                break;
                            case 2: Img = tank.Properties.Resources._1_1;
                                break;
                        }
                        break;
                    }
                case _BlockType.Brick_Box_Red:
                    {
                        switch (Var)
                        {
                            case 1: Img = tank.Properties.Resources._1_8;
                                break;
                            case 2: Img = tank.Properties.Resources._1_9;
                                break;
                        }
                        break;
                    }
                case _BlockType.Place_Green:
                    {
                        Img = tank.Properties.Resources._2;
                        break;
                    }
                case _BlockType.Brick_Box_Iron:
                    {
                        Img = tank.Properties.Resources._9;
                        break;
                    }
                case _BlockType.Base:
                    {
                        Size = new Size(64, 64);
                        Img = tank.Properties.Resources.baseImg;
                        break;
                    }

                default:
                    break;
            }
        }

        public void Draw(Graphics graphics)
        {
            graphics.DrawImage(Img, Location);
        }
    }
}
